package com.pomr.model.simstorage;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;
import org.hibernate.annotations.GenericGenerator;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pomr.model.menu.NetworkOperator;
import com.pomr.model.synthesize.Manufacturer;
import com.pomr.model.sys.Agency;
import com.pomr.model.sys.User;

/**
 * sim卡入库表
 * @author Administrator
 *
 */
@Entity
@Table(name="siminstorage")
public class SimInStorage implements Serializable{
	
	public String getPreiccid() {
		return preiccid;
	}

	public void setPreiccid(String preiccid) {
		this.preiccid = preiccid;
	}

	public String getSubficcid() {
		return subficcid;
	}

	public void setSubficcid(String subficcid) {
		this.subficcid = subficcid;
	}

	public String getStarticcid() {
		return starticcid;
	}

	public void setStarticcid(String starticcid) {
		this.starticcid = starticcid;
	}

	public String getEndiccid() {
		return endiccid;
	}

	public void setEndiccid(String endiccid) {
		this.endiccid = endiccid;
	}

	public String getCreateUserName() {
		return createUserName;
	}

	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getAppid() {
		return appid;
	}

	public void setAppid(String appid) {
		this.appid = appid;
	}

	public String getPrefixIMSI() {
		return prefixIMSI==null?"":prefixIMSI;
	}

	public void setPrefixIMSI(String prefixIMSI) {
		this.prefixIMSI = prefixIMSI;
	}

	public String getSubfixIMSI() {
		return subfixIMSI==null?"":subfixIMSI;
	}

	public void setSubfixIMSI(String subfixIMSI) {
		this.subfixIMSI = subfixIMSI;
	}

	public String getStartIMSI() {
		return startIMSI==null?"":startIMSI;
	}

	public void setStartIMSI(String startIMSI) {
		this.startIMSI = startIMSI;
	}

	public String getEndIMSI() {
		return endIMSI==null?"":endIMSI;
	}

	public void setEndIMSI(String endIMSI) {
		this.endIMSI = endIMSI;
	}

	public String getPrefix() {
		return prefix==null?"":prefix;
	}

	public void setPrefix(String prefix) {
		this.prefix = prefix;
	}

	public String getSubfix() {
		return subfix==null?"":subfix;
	}

	public void setSubfix(String subfix) {
		this.subfix = subfix;
	}

	public NetworkOperator getNetworkOperator() {
		return networkOperator;
	}

	public void setNetworkOperator(NetworkOperator networkOperator) {
		this.networkOperator = networkOperator;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	

	public String getNerworkName() {
		return nerworkName;
	}

	public void setNerworkName(String nerworkName) {
		this.nerworkName = nerworkName;
	}

	public Manufacturer getManufacturer() {
		return manufacturer;
	}

	public void setManufacturer(Manufacturer manufacturer) {
		this.manufacturer = manufacturer;
	}

	public String getManufacturerName() {
		return manufacturerName;
	}

	public void setManufacturerName(String manufacturerName) {
		this.manufacturerName = manufacturerName;
	}

	public Agency getAgency() {
		return agency;
	}

	public void setAgency(Agency agency) {
		this.agency = agency;
	}

	public String getAgencyName() {
		return agencyName;
	}

	public void setAgencyName(String agencyName) {
		this.agencyName = agencyName;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public Integer getNumber() {
		return number;
	}

	public void setNumber(Integer number) {
		this.number = number;
	}

	public String getStartSN() {
		return startSN==null?"":startSN;
	}

	public void setStartSN(String startSN) {
		this.startSN = startSN;
	}

	public String getEndSN() {
		return endSN==null?"":endSN;
	}

	public void setEndSN(String endSN) {
		this.endSN = endSN;
	}

	public Date getInTime() {
		return inTime;
	}

	public void setInTime(Date inTime) {
		this.inTime = inTime;
	}

	public User getInUser() {
		return inUser;
	}

	public void setInUser(User inUser) {
		this.inUser = inUser;
	}

	public String getInUserName() {
		return inUserName;
	}

	public void setInUserName(String inUserName) {
		this.inUserName = inUserName;
	}

	public User getCreateUser() {
		return createUser;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "native")
    @GenericGenerator(name = "native", strategy = "native")//AUTO 在mysql中需要指定使用本地策略生成主键值
	private Integer id;//主键
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="nerwork_id")
	private NetworkOperator networkOperator;//网络运营商
	
	@Formula("(select e.name from menu_network e where e.id=nerwork_id)")
	private String nerworkName;//网络运营商名称
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="manufacturer_id")
	private Manufacturer manufacturer;//生产厂商主键
	
	@Formula("(select m.name from manufacturer m where m.id=manufacturer_id)")
	private String manufacturerName;//厂商名称
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="agency_id")
	private Agency agency;//机构主键
	
	@Formula("(select a.name from agency a where a.id=agency_id)")
	private String agencyName;//机构名称
	
	@Column(name="price",columnDefinition="double(10,2) default '0.00'")
	private double price;//价格
	
	@Column(name="number")
	private Integer number;//数量
	@Column(name="prefix",length=20)
	private String prefix;//前置
	@Column(name="subfix",length=20)
	private String subfix;//后置
	
	@Column(name="startSN",length=20)
	private String startSN;//起始编码
	
	@Column(name="endSN",length=20)
	private String endSN;//结束编码
	
	@Column(name="prefixIMSI",length=20)
	private String prefixIMSI;//前置
	@Column(name="subfixIMSI",length=20)
	private String subfixIMSI;//后置
	
	@Column(name="startIMSI",length=20)
	private String startIMSI;//起始IMSI
	
	@Column(name="endIMSI",length=20)
	private String endIMSI;//结束IMSI
	
	@Column(name="appid",length=30)
	private String appid;//用户名
	
	@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
	@Column(name="inTime")
	private Date inTime;//入库日期
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="inUser")
	private User inUser;//入库人员id
	
	@Formula("(select u.name from user u where u.id=inUser)")
	private String inUserName;//入库人姓名
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="createUser")
	private User createUser;//创建人员id
	@Formula("(select u1.name from user u1 where u1.id=createUser)")
	private String createUserName;//创建人
	
	@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 
	@Column(name="createTime")
	private Date createTime;//创建日期
	
	@Column(name="remark",length=200)
	private String remark;//备注
	@Column(name="state",length=5)
	private String state;//审核状态  1审核通过
	
	@Column(name="prefix_iccid",length=20)
	private String preiccid;//iccid编码 前缀
	@Column(name="subfix_iccid",length=20)
	private String subficcid;//iccid编码 后缀
	@Column(name="start_iccid",length=20)
	private String starticcid;//iccid编码 开始
	@Column(name="end_iccid",length=20)
	private String endiccid;//iccid编码 结束

}
